﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Media.Imaging;
using System.IO;

namespace devtm.AutoMapper
{
    
    public static class ImageHelper
    {


        public static BitmapImage GetBitmapImage(this byte[] array)
        {
            BitmapImage bi = new BitmapImage();
            bi.BeginInit();
            bi.StreamSource = new MemoryStream(array);
            bi.EndInit();
            bi.Freeze();
            return bi;
        }


        public static byte[] GetBytes(this System.Drawing.Image img)
        {
            MemoryStream ms = new MemoryStream();
            img.Save(ms, System.Drawing.Imaging.ImageFormat.Png);
            return ms.ToArray();


        }
    }
}
